package com.sample.tdf.api;

import cn.com.taiji.common.api.BaseTreeController;
import cn.com.taiji.common.dto.ResultDTO;
import com.sample.tdf.dto.OrganizationDTO;
import com.sample.tdf.service.IOrganizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = {"1002.组织机构操作接口"})
@RequestMapping("/exercise/organization")
public class OrganizationController extends BaseTreeController<IOrganizationService, OrganizationDTO> {
    @Autowired
    private IOrganizationService iOrganizationService;

    @GetMapping("/findAsTree")
    @ApiOperation(value = "12.查询某个机构下的所有员工为树")
    public ResultDTO findAsTreeById(String organizationId) {
        List<OrganizationDTO> dtoTree = iOrganizationService.findTreeById(organizationId);

        return new ResultDTO(dtoTree);
    }
}
